﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;
using System.Data.Common;

using Husb.Data;
using Husb.DataUtil;
using Microsoft.Practices.EnterpriseLibrary.Data;

using CentralOffice.Archive.Data;

using PublicDatumTable = CentralOffice.Archive.Data.PublicDatumDataSet.PublicDatumDataTable;
using PublicDatumRow = CentralOffice.Archive.Data.PublicDatumDataSet.PublicDatumRow;

namespace CentralOffice.Archive.DataAccess
{
    public class PublicDatumAdapter : DataAccessAdapter<PublicDatumDataSet, PublicDatumTable, PublicDatumRow>
    {
        public PublicDatumAdapter()
        {
            this.TableName = "PublicDatum";

            GetAllStoredProc = "Archive.PublicDatum_SelectPublicDataAll";
            InsertStoredProc = "Archive.PublicDatum_InsertPublicDatum";
            UpdateStoredProc = "Archive.PublicDatum_UpdatePublicDatum";
            DeleteStoredProc = "Archive.PublicDatum_DeletePublicDatum";

            GetByIdStoredProc = "Archive.PublicDatum_SelectPublicDatum";
            GetByNameStoredProc   = "";
            GetPagedStoredProc = "Archive.PublicDatum_SelectPublicDataPaged";
            GetRowCountStoredProc = "Archive.PublicDatum_SelectPublicDataRowCount";
            FindStoredProc = "Archive.PublicDatum_SelectPublicDataDynamic";

            LogicalDeleteStoredProc = "Archive.PublicDatum_DeletePublicDatumLogical";
        }

        protected override void PopulateInsertParameters(Database db, DbCommand cmd)
        {
            //db.AddInParameter(cmd, "Id", DbType.Guid, "Id", DataRowVersion.Current);
			db.AddInParameter(cmd, "Id", DbType.Guid, "Id", DataRowVersion.Current);
			db.AddInParameter(cmd, "Name", DbType.String, "Name", DataRowVersion.Current);
			db.AddInParameter(cmd, "Category", DbType.Int32, "Category", DataRowVersion.Current);
			db.AddInParameter(cmd, "Remark", DbType.String, "Remark", DataRowVersion.Current);
			db.AddInParameter(cmd, "UploadDate", DbType.DateTime, "UploadDate", DataRowVersion.Current);
			db.AddInParameter(cmd, "Attachments", DbType.String, "Attachments", DataRowVersion.Current);
			db.AddInParameter(cmd, "IsDeleted", DbType.Boolean, "IsDeleted", DataRowVersion.Current);
			db.AddInParameter(cmd, "IsActive", DbType.Boolean, "IsActive", DataRowVersion.Current);
			db.AddInParameter(cmd, "CreatedTime", DbType.DateTime, "CreatedTime", DataRowVersion.Current);
			db.AddInParameter(cmd, "CreatedBy", DbType.Guid, "CreatedBy", DataRowVersion.Current);
			db.AddInParameter(cmd, "ModifiedTime", DbType.DateTime, "ModifiedTime", DataRowVersion.Current);
			db.AddInParameter(cmd, "LastModifiedBy", DbType.Guid, "LastModifiedBy", DataRowVersion.Current);
			db.AddInParameter(cmd, "Version", DbType.Int32, "Version", DataRowVersion.Current);
			db.AddInParameter(cmd, "Description", DbType.AnsiString, "Description", DataRowVersion.Current);
        }
    }
}
